/**
 * Created by Administrator on 2016/12/16.
 */

import gulp from 'gulp';
import util from '../util';

gulp.task('third:dev', function () {
    return gulp.src('./grsc-base/third/**/*')
        // .pipe(util.removeDirname())
        .pipe(gulp.dest('./dev/third'))
});

gulp.task('third:server', function () {

    const reload = global.browserSync.reload;
    const files = './grsc-base/third/**/*';

    function todo(path = files) {
        return gulp.src(path)
            // .pipe(util.removeDirname())
            .pipe(gulp.dest('./dev/third'))
            .pipe(reload({stream: true}))
    }

    gulp.watch(files, function (event) {
        let path = event.path;
        return todo(path);
    });

    return todo();

});

gulp.task('third:prod', ['third:dev'], function () {
    return gulp.src('./dev/third/**/*')
        .pipe(gulp.dest('./prod/third'));
});